<%@page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/common/session.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, minimum-scale=1.0, maximum-scale=2.0, user-scalable=no, width=device-width">
    <LINK type="text/css" rel="stylesheet" href="${ctx}/css/default.css"/>
    <script type="text/javascript" src="${ctx}/js/xtable.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/engine.js"></script>
    <script type="text/javascript" src="${ctx}/dwr/util.js"></script>
    <script type='text/javascript' src='${ctx}/dwr/interface/MarketRpcService.js'></script>
    <script type="text/javascript" src="${ctx}/js/loading.js"></script>
</head>
<body>

<p class="contact-input" style="text-align: right">
    <button type="button" onclick="submitMarket('')">添加市场</button>
</p>
   
<SCRIPT LANGUAGE="JavaScript" >
    var marketThead = new Array(
            new XThead("选择", "radio"),
            new XThead("市场名称"),
            new XThead("市场LOGO"),
            new XThead("市场简称"),
            new XThead("联系电话"),
            new XThead("修改")
    );

    var marketXTable = new XTable("market", marketThead, true);

    marketXTable.XTbodyArray = function (model) {
        var array = new Array(
                new XTbody("market", model.marketId, "radio", "onclick='setMarket(this)'", model, "string", null, null, "center"),
                new XTbody("market", model.marketName, "string", null, null, "center"),
                new XTbody("market", (model.marketLogo == null?"":"<img src='${fdfsPath}"+model.marketLogo+".w_100xh_100' />"),"string", null, null, "center"),
                new XTbody("market", model.marketShortName, "string", null, null, "center"),
                new XTbody("market", model.marketMobile, "string", null, null, "center"),
                new XTbody("market", "<a href='#'  class='contact-input' onclick=submitMarket('"+ model.marketId +"')>编辑</a>", "string", null, null, "center")
    );
        return array;
    }


    function getMarketPage() {
        var market = new Market();
//         market.marketId = dwr.util.getValue("marketId");
        market.marketId = "${marketId}";
        MarketRpcService.selectMarketList(market, function (list) {
            marketXTable.addTable(list);
        });
    }
</SCRIPT>
</body>
</html>
<script>

     getMarketPage();

    function submitMarket(marketId){
        location = "${ctx}/market/market_manage.jsp?marketId=" + marketId;
    }

</script>
